function show(obj, height) {
    var a = document.getElementById('s' + obj);
    var b = document.getElementById('c' + obj);
    document.getElementById('s' + obj).style.display = "";
    b.className = 'sel';
    if (a.offsetHeight < height) {
        a.style.height = (a.offsetHeight + 10) + "px";
        setTimeout(function () {
            show(obj, height)
        }, 30);
    }
    else {
        bl = 0;
        document.getElementById('s' + obj).style.overflow = "visible"
    }
}

function hide(obj) {
    var a = document.getElementById('s' + obj);
    var b = document.getElementById('c' + obj);
    document.getElementById('s' + obj).style.overflow = "hidden";
    if (a.offsetHeight > 1) {
        a.style.height = (a.offsetHeight - 10) + "px";
        setTimeout(function () {
            hide(obj)
        }, 30);
    }
    else {
        bl = 0;
        b.className = '';
        document.getElementById('s' + obj).style.display = "none";
    }
}

var bl = 0;
function showhide(obj) {
    var a = document.getElementById('s' + obj);
    var checkBoxes = a.getElementsByTagName('input');
    var height;
    if (checkBoxes.length > 2) {
        height = checkBoxes.length * 21 + 10;
    } else {
        height = 0;
    }
    if (bl == 1) {
        return false;
    }
    bl = 1;
    if (a.offsetHeight < height) {
        show(obj, height)
    }
    else {
        hide(obj)
    }
}

function selectAll(obj) {
    var section = document.getElementById('s' + obj);
    var inputElements = section.getElementsByTagName('input');
    var checked = inputElements[0].checked;
    for(var i=1; i< inputElements.length; i++) {
        if (inputElements[i].name == "files") {
            inputElements[i].checked = checked;
        }
    }
}